package configuration.dataObjects
{
	import mx.collections.ArrayCollection;
	import common.utils.DateManager;
	
	[Bindable]
	public class TaskCreationMasterDO
	{
		public var INTERNAL_MASTER_NUM:Number = 0;
		public var RECORD_TYPE:String = "";
		public var DESCRIPTION:String = "";
		public var TASK_TYPE:String = "";
		public var PRIORITY:Number = 0;
		public var FILTER_NAME:String = "";
		public var MAXIMUM_QTY:Number = 0;
		public var QUANTITY_UM:String = "";
		public var MAXIMUM_WEIGHT:Number = 0;
		public var WEIGHT_UM:String = "";
		public var MAXIMUM_VOLUME:Number = 0;
		public var VOLUME_UM:String = "";
		public var MAXIMUM_INSTRUCTIONS:Number = 0;
		public var USER_STAMP:String = "";
		public var DATE_TIME_STAMP:String = DateManager.GetTodayString();
		public var TASK_ID_FIELD:String = "";
		public var INTERNAL_TASK_TYPE:String = "";


		public function TaskCreationMasterDO()
		{		
		}
	
		public function Init(xmlObj:XML):void{				
			if(null == xmlObj)
				return;
			else{
				for each (var itemProp:XML in xmlObj.children()) {			
					this[itemProp.name()] = itemProp;
				}
			}
		}
		
		public function ToXML():XML{
			var xmlObj:XML =
				<TASK_CREATION_MASTER>
					<INTERNAL_MASTER_NUM>{INTERNAL_MASTER_NUM}</INTERNAL_MASTER_NUM>
					<RECORD_TYPE>{RECORD_TYPE}</RECORD_TYPE>
					<DESCRIPTION>{DESCRIPTION}</DESCRIPTION>
					<TASK_TYPE>{TASK_TYPE}</TASK_TYPE>
					<PRIORITY>{PRIORITY}</PRIORITY>
					<FILTER_NAME>{FILTER_NAME}</FILTER_NAME>
					<MAXIMUM_QTY>{MAXIMUM_QTY}</MAXIMUM_QTY>
					<QUANTITY_UM>{QUANTITY_UM}</QUANTITY_UM>
					<MAXIMUM_WEIGHT>{MAXIMUM_WEIGHT}</MAXIMUM_WEIGHT>
					<WEIGHT_UM>{WEIGHT_UM}</WEIGHT_UM>
					<MAXIMUM_VOLUME>{MAXIMUM_VOLUME}</MAXIMUM_VOLUME>
					<VOLUME_UM>{VOLUME_UM}</VOLUME_UM>
					<MAXIMUM_INSTRUCTIONS>{MAXIMUM_INSTRUCTIONS}</MAXIMUM_INSTRUCTIONS>
					<USER_STAMP>{USER_STAMP}</USER_STAMP>
					<DATE_TIME_STAMP>{DATE_TIME_STAMP}</DATE_TIME_STAMP>
					<TASK_ID_FIELD>{TASK_ID_FIELD}</TASK_ID_FIELD>
					<INTERNAL_TASK_TYPE>{INTERNAL_TASK_TYPE}</INTERNAL_TASK_TYPE>
				</TASK_CREATION_MASTER>;
			return xmlObj;
		}
		
		public static function getItems(list:XMLList):ArrayCollection
		{
			var ac:ArrayCollection = new ArrayCollection();
			for each(var xml:XML in list)
			{
				var itm:TaskCreationMasterDO = new TaskCreationMasterDO();
				itm.Init(xml);
				ac.addItem(itm);
			}
			return ac;
		}
	}
}